
public class ElectronicSecuredNotepad implements
		IElectronicDevice {
	
	private boolean isStarted;
	private SecureNotepad secured;
	
	public ElectronicSecuredNotepad(int numberOfPages, String enteredPassword, boolean isStarted) {
		this.secured = SecureNotepad.createSecureNotepad(numberOfPages, enteredPassword);
		this.isStarted = isStarted;
	}

	@Override
	public void start() {
		if(isStarted == false){
			isStarted = true;
			System.out.println("The device Has started");
		}else{
			System.out.println("The device is turned on");
		}
	}

	@Override
	public void stop() {
		if(isStarted == true){
			isStarted = false;
			System.out.println("The device has been turned off");
		}else{
			System.out.println("The device is turned off");
		}

	}

	@Override
	public boolean isStarted() {
		if(isStarted == true){
			return true;
		}
		System.out.println("The Divice is not Started");
		return false;
	}

	@Override
	public boolean searchWord(String word) {
		if(isStarted()){
			return secured.searchWord(word);
		}
		return false;
		
	}

	@Override
	public void addTextToPage(int pageNumber, String text) {
		if(isStarted()){
			secured.addTextToPage(pageNumber, text);
		}
		
	}

	@Override
	public void overWriteTextOnPage(int pageNumber, String text) {
		if(isStarted()){
			secured.overWriteTextOnPage(pageNumber, text);
		}
		
	}

	@Override
	public void deleteTextOnPage(int pageNumber) {
		if(isStarted()){
			secured.deleteTextOnPage(pageNumber);
		}
		
	}

	@Override
	public void showNotepad() {
		if(isStarted()){
			secured.showNotepad();
		}
		
	}

	@Override
	public void printAllPagesWithDigits() {
		if(isStarted()){
			secured.showNotepad();
		}
	}

}
